package src;
import java_cup.runtime.*;
%%

%class CalcLexer

%line
%column
%cup

%{   
    /* To create a new java_cup.runtime.Symbol with information about
       the current token, the token will have no value in this
       case. */
    private Symbol symbol(int type) {
        return new Symbol(type, yyline, yycolumn);
    }
    
    /* Also creates a new java_cup.runtime.Symbol with information
       about the current token, but this object has a value. */
    private Symbol symbol(int type, Object value) {
        return new Symbol(type, yyline, yycolumn, value);
    }
%}


%%


[ ]+         { }
[Cc][Rr][Ee][Aa][Tt][Ee]     {return symbol(sym.CREATE);}
[Tt][Aa][Bb][Ll][Ee]      {return symbol(sym.TABLE);}
[Ii][Nn][Ss][Ee][rR][tT]     {return symbol(sym.INSERT);}
[Ii][Nn][tT][oO]       {return symbol(sym.INTO);}
[Vv][Aa][Ll][Uu][Ee][Ss]     {return symbol(sym.VALUES);}
[Dd][Ee][Ll][Ee][Tt][Ee]     {return symbol(sym.DELETE);}
[Ss][Ee][Ll][Ee][Cc][Tt]     {return symbol(sym.SELECT);}
[Ff][Rr][Oo][Mm]     	  {return symbol(sym.FROM);}
[Ww][Hh][Ee][Rr][Ee]      {return symbol(sym.WHERE);}
[Uu][Pp][Dd][Aa][Tt][Ee]     {return symbol(sym.UPDATE);}
[Dd][Rr][Oo][Pp]     {return symbol(sym.DROP);}
[Ss][Ee][Tt]        {return symbol(sym.SET);}
[Ii][nN]         {return symbol(sym.IN);}
[Pp][Rr][iI][mM][aA][rR][yY][ ][kK][Ee][Yy] {return symbol(sym.PRIMARYKEY);}
","          {return symbol(sym.COMMA);}
"("		     {return symbol(sym.LPAREN);}
")"		     {return symbol(sym.RPAREN);}
"="          {return symbol(sym.EQUAL);}
">"          {return symbol(sym.G);}
"<"          {return symbol(sym.L);}
">="         {return symbol(sym.GE);}
"<="         {return symbol(sym.LE);}
[aA][nN][dD]  {return symbol(sym.AND);}
[oO][rR]  {return symbol(sym.OR);}
[nN][oO][tT]  {return symbol(sym.NOT);}
[Ll][Ii][Kk][Ee]        {return symbol(sym.LIKE);}
"*"          {return symbol(sym.ALL);}
"\""         {return symbol(sym.APOSTROPH);}
[a-zA-Z_0-9]+  { return symbol(sym.STRING, new String(yytext()));}
[\*\+\?\[\]a-zA-Z_0-9]+  { return symbol(sym.PATTERN, new String(yytext()));}
.|\n	{ }